using System.Collections.Generic;

// =========================================================
// 基础攻击卡牌
// =========================================================

/// <summary>
/// 打击 - 基础攻击牌
/// </summary>
public class StrikeCard : Card
{
    public StrikeCard(CardManager cm, EffectSystem es) : base(cm, es) { }

    protected override void InitializeCard()
    {
        id = "strike";
        name = "打击";
        energyCost = 1;
        cardType = CardType.Attack;
        rarity = Rarity.Common;
        targetType = TargetType.Enemy;
        description = "造成6点伤害。";
    }

    public override void OnUse(ITarget user, List<ITarget> targets)
    {
        if (targets == null || targets.Count == 0) return;

        ITarget target = targets[0];
        effectSystem.ApplyDamage(user, target, 6);
    }

    public override Card Clone()
    {
        return new StrikeCard(cardManager, effectSystem);
    }
}

/// <summary>
/// 重击 - 高伤害攻击牌
/// </summary>
public class BashCard : Card
{
    public BashCard(CardManager cm, EffectSystem es) : base(cm, es) { }

    protected override void InitializeCard()
    {
        id = "bash";
        name = "重击";
        energyCost = 2;
        cardType = CardType.Attack;
        rarity = Rarity.Common;
        targetType = TargetType.Enemy;
        description = "造成8点伤害，并施加2层易伤。";
    }

    public override void OnUse(ITarget user, List<ITarget> targets)
    {
        if (targets == null || targets.Count == 0) return;

        ITarget target = targets[0];

        // 造成伤害
        effectSystem.ApplyDamage(user, target, 8);

        // 施加易伤
        effectSystem.ApplyBuff(target, BuffType.Vulnerable, 2, true);
    }


    public override Card Clone()
    {
        return new BashCard(cardManager, effectSystem);
    }
}

// =========================================================
// 基础技能卡牌
// =========================================================

/// <summary>
/// 防御 - 基础防御牌
/// </summary>
public class DefendCard : Card
{
    public DefendCard(CardManager cm, EffectSystem es) : base(cm, es) { }

    protected override void InitializeCard()
    {
        id = "defend";
        name = "防御";
        energyCost = 1;
        cardType = CardType.Skill;
        rarity = Rarity.Common;
        targetType = TargetType.Self;
        description = "获得5点格挡。";
    }

    public override void OnUse(ITarget user, List<ITarget> targets)
    {
        effectSystem.ApplyBlock(user, 5);
    }

    public override Card Clone()
    {
        return new DefendCard(cardManager, effectSystem);
    }
}

/// <summary>
/// 耸肩 - 防御并抽牌
/// </summary>
public class ShrugItOffCard : Card
{
    public ShrugItOffCard(CardManager cm, EffectSystem es) : base(cm, es) { }

    protected override void InitializeCard()
    {
        id = "shrug_it_off";
        name = "耸肩";
        energyCost = 1;
        cardType = CardType.Skill;
        rarity = Rarity.Common;
        targetType = TargetType.Self;
        description = "获得8点格挡，抽1张牌。";
    }

    public override void OnUse(ITarget user, List<ITarget> targets)
    {
        // 获得格挡
        effectSystem.ApplyBlock(user, 8);

        // 抽1张牌
        cardManager.DrawCard(1);
    }

    public override Card Clone()
    {
        return new ShrugItOffCard(cardManager, effectSystem);
    }
}

/// <summary>
/// 盛怒 - 获得力量
/// </summary>
public class AngerCard : Card
{
    public AngerCard(CardManager cm, EffectSystem es) : base(cm, es) { }

    protected override void InitializeCard()
    {
        id = "anger";
        name = "盛怒";
        energyCost = 0;
        cardType = CardType.Attack;
        rarity = Rarity.Common;
        targetType = TargetType.Enemy;
        description = "造成6点伤害，将一张盛怒加入弃牌堆。";
    }

    public override void OnUse(ITarget user, List<ITarget> targets)
    {
        if (targets == null || targets.Count == 0) return;

        // 造成伤害
        effectSystem.ApplyDamage(user, targets[0], 6);

        // 将一张盛怒加入弃牌堆
        Card newAnger = new AngerCard(cardManager, effectSystem);
        // 这里需要访问 discardPile，可能需要通过 CardManager 的方法
    }

    public override Card Clone()
    {
        return new AngerCard(cardManager, effectSystem);
    }
}

/// <summary>
/// 坚毅 - 获得格挡和力量
/// </summary>
public class FortitudeCard : Card
{
    public FortitudeCard(CardManager cm, EffectSystem es) : base(cm, es) { }

    protected override void InitializeCard()
    {
        id = "fortitude";
        name = "坚毅";
        energyCost = 1;
        cardType = CardType.Skill;
        rarity = Rarity.Uncommon;
        targetType = TargetType.Self;
        description = "获得4点格挡和1点力量。";
    }

    public override void OnUse(ITarget user, List<ITarget> targets)
    {
        // 获得格挡
        effectSystem.ApplyBlock(user, 4);

        // 获得力量
        effectSystem.ApplyBuff(user, BuffType.Strength, 1, true);
    }

    public override Card Clone()
    {
        return new FortitudeCard(cardManager, effectSystem);
    }
}